package main

import (
	"fmt"
	"mrlab/mr"
	"os"
)

func main() {
	lis, err := os.ReadDir("./input/")
	if err != nil {
		fmt.Printf("err: %v\n", err)
		return
	}
	filelis := []string{}
	for _, de := range lis {
		filelis = append(filelis, de.Name())
	}
	fmt.Printf("filelis: %v\n", filelis)
	//
	for i, filename := range filelis {
		fmt.Printf("filename:%v index:%v\n", filename, i)
		file, err := os.Open("./input/" + filename)
		if err != nil {
			fmt.Printf("1-err: %v\n", err)
			return
		}
		con, err := mr.Read2String(file)
		// con, err := ioutil.ReadAll(file)
		if err != nil {
			fmt.Printf("2-err: %v\n", err)
			return
		}
		fmt.Printf("len: %v\n", len(con))
	}
}
